<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;

$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$basic=$this->plugin_setting('basic');
$return['banner']=$basic['image'];
$return['basic']=$basic;
//我的收藏
if($_RQ['op']=='main'){
	$shoucanglist=pdo_getall('jy_zhongchou_shoucang',array('uniacid'=>$_SESSION['uniacid'],'isfollow'=>1,'mid'=>$_SESSION['uid']),'','createtime desc');
	$list=array();
	if($shoucanglist){
		foreach($shoucanglist as &$item){
			$item['project']=pdo_get('jy_zhongchou_project',array('id'=>$item['pid'],'uniacid'=>$_SESSION['uniacid']));
			array_push($list,$item);
		}
	}
	if($list){
		$sum=count($list);
		foreach($list as &$item){
			$classify=pdo_get('jy_zhongchou_classify',array('id'=>$item['cid'],'uniacid'=>$_SESSION['uniacid']));
			$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
			$item['classify']=$classify;
			if($item['status']==0){
				$item['status']='众筹中';
			}else{
				$item['status']='众筹结束';
			}
		}
	}
	$return['list']=$list;
	$return['sum']=$sum;
	exi($return);

}

if($_RQ['op']=='unfollow'){
	$postdata=get_postdata();
	$id = intval($postdata['id']);
	pdo_update('jy_zhongchou_shoucang',array('isfollow'=>0),array('uniacid'=>$_SESSION['uniacid'],'id'=>$id));
	$return['ok']=1;
	exi($return);
}
